package com.hbt.active_mq.my_active_mq;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jms.annotation.JmsListener;
import org.springframework.jms.core.JmsMessagingTemplate;
import org.springframework.stereotype.Component;

import javax.jms.Queue;

@Component
public class Consumer {
    @Autowired
    JmsMessagingTemplate template;

    @JmsListener(destination = "mq1")
    public void listener(String msg){
        System.out.println("接收到消息："+msg);
    }

    @JmsListener(destination = "topic1")
    public void listenerTopic(String msg){
        System.out.println("topic0接收到消息："+msg);
    }
    @JmsListener(destination = "topic1")
    public void listenerTopic1(String msg){
        System.out.println("topic1接收到消息："+msg);
    }
    @JmsListener(destination = "topic1")
    public void listenerTopic2(String msg){
        System.out.println("topic2接收到消息："+msg);
    }
}

